(function(){
    var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
    var isOpera = userAgent.indexOf("Opera") > -1;//判断是否Opera浏览器
    var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
    var isFF = userAgent.indexOf("Firefox") > -1; //判断是否Firefox浏览器
    var isSafari = userAgent.indexOf("Safari") > -1; //判断是否Safari浏览器    
    var pathname = /\/compatible\//.test(location.pathname); //查看是否在IE8版本下
    var senior_url = location.pathname.replace(/\/compatible\//,'') + location.search; //高版本需要将compatible路径切换掉
    var compatible_url = location.pathname.replace(/\/page\//,function($0,$1) {return 'compatible' + $0;}) + location.search;//兼容浏览器路径
    //高版本浏览器、不在IE8页面下直接return;
    if(!isIE && !pathname) return;  
    //否则跳转
    if(!isIE && pathname) {
         window.location.href = "../../../../" + senior_url;
         return;
    }
    var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
    //匹配的是上一次正则匹配到的子集
    reIE.test(userAgent);
    var fIEVersion = parseFloat(RegExp["$1"]);  
    switch(true) {
         case pathname && fIEVersion === 8 || !pathname && fIEVersion > 8:
         return;
         break;
         case pathname && fIEVersion > 8:
         window.location.href = "../../../../" + senior_url;
         break;
         case !pathname && fIEVersion === 8:
         window.location.href= '../../../' + compatible_url;
         break
      }
    function hookAjax() {
     var _ajax = $.ajax;
     $.ajax = function(option) {  
           var _success = option.success;
           option.success = function(a,b,c) {
              if(c.status === 200) {
                 return;
              }
              _success(a,b,c);
           }                  
           var promise =  _ajax(option);  
           var _then = promise.then;
           promise.then = function(callbback) {
               _then(function(a,b,c) {
                  if(c.status === 200) {
                     return;
                  }  
                  callbback(a,b,c);                 
               })
           }
           return promise;
     }
    }
})()